<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">

	<title>Class LeanCloud\File</title>

	<link rel="stylesheet" href="resources/style.css?c2f33731c1948fbed7c333554678bfa68d4817da">

</head>

<body>
<div id="left">
	<div id="menu">
		<a href="index.html" title="Overview"><span>Overview</span></a>


		<div id="groups">
				<h3>Namespaces</h3>
			<ul>
				<li class="active">
					<a href="namespace-LeanCloud.html">
						LeanCloud<span></span>
					</a>

						<ul>
				<li>
					<a href="namespace-LeanCloud.Engine.html">
						Engine					</a>

						</li>
				<li>
					<a href="namespace-LeanCloud.Operation.html">
						Operation					</a>

						</li>
				<li>
					<a href="namespace-LeanCloud.Storage.html">
						Storage					</a>

						</li>
				<li>
					<a href="namespace-LeanCloud.Uploader.html">
						Uploader					</a>

						</li>
							</ul></li>
			</ul>
		</div>

		<hr>


		<div id="elements">
			<h3>Classes</h3>
			<ul>
				<li><a href="class-LeanCloud.ACL.html">ACL</a></li>
				<li><a href="class-LeanCloud.Bytes.html">Bytes</a></li>
				<li><a href="class-LeanCloud.Client.html">Client</a></li>
				<li class="active"><a href="class-LeanCloud.File.html">File</a></li>
				<li><a href="class-LeanCloud.GeoPoint.html">GeoPoint</a></li>
				<li><a href="class-LeanCloud.MIMEType.html">MIMEType</a></li>
				<li><a href="class-LeanCloud.Object.html">Object</a></li>
				<li><a href="class-LeanCloud.Push.html">Push</a></li>
				<li><a href="class-LeanCloud.Query.html">Query</a></li>
				<li><a href="class-LeanCloud.Relation.html">Relation</a></li>
				<li><a href="class-LeanCloud.Role.html">Role</a></li>
				<li><a href="class-LeanCloud.SaveOption.html">SaveOption</a></li>
				<li><a href="class-LeanCloud.SMS.html">SMS</a></li>
				<li><a href="class-LeanCloud.User.html">User</a></li>
			</ul>



			<h3>Exceptions</h3>
			<ul>
				<li><a href="class-LeanCloud.BatchRequestError.html">BatchRequestError</a></li>
				<li><a href="class-LeanCloud.CloudException.html">CloudException</a></li>
			</ul>


		</div>
	</div>
</div>

<div id="splitter"></div>

<div id="right">
<div id="rightInner">
	<form id="search">
		<input type="hidden" name="cx" value="">
		<input type="hidden" name="ie" value="UTF-8">
		<input type="text" name="q" class="text" placeholder="Search">
	</form>

	<div id="navigation">
		<ul>
			<li>
				<a href="index.html" title="Overview"><span>Overview</span></a>
			</li>
			<li>
				<a href="namespace-LeanCloud.html" title="Summary of LeanCloud"><span>Namespace</span></a>
			</li>
			<li class="active">
<span>Class</span>			</li>
		</ul>
		<ul>
		</ul>
		<ul>
		</ul>
	</div>

<div id="content" class="class">
	<h1>Class File</h1>


	<div class="description">
	<p>File object on LeanCloud</p>
	</div>









	<div class="info">
		
		
		<b>Namespace:</b> <a href="namespace-LeanCloud.html">LeanCloud</a><br>
		

			<b>Located at</b> <a href="source-class-LeanCloud.File.html#10-443" title="Go to source code">LeanCloud/File.php</a>
		<br>
	</div>



	<table class="summary methods" id="methods">
	<caption>Methods summary</caption>
	<tr data-order="__construct" id="___construct">

		<td class="attributes"><code>
			 public 

			
			
			</code>
		</td>

		<td class="name"><div>
		<a class="anchor" href="#___construct">#</a>
		<code><a href="source-class-LeanCloud.File.html#44-68" title="Go to source code">__construct</a>( <span>string <var>$name</var></span>, <span>mixed <var>$data</var> = <span class="php-keyword1">null</span></span>, <span>string <var>$mimeType</var> = <span class="php-keyword1">null</span></span> )</code>

		<div class="description short">
			<p>Initialize file</p>
		</div>

		<div class="description detailed hidden">
			<p>Initialize file</p>


				<h4>Parameters</h4>
				<div class="list"><dl>
					<dt><var>$name</var></dt>
					<dd>File base name</dd>
					<dt><var>$data</var></dt>
					<dd>(optional) File content</dd>
					<dt><var>$mimeType</var></dt>
					<dd>(optional) Mime type</dd>
				</dl></div>





		</div>
		</div></td>
	</tr>
	<tr data-order="createWithUrl" id="_createWithUrl">

		<td class="attributes"><code>
			 public static

			<code><a href="class-LeanCloud.File.html">LeanCloud\File</a></code>
			
			</code>
		</td>

		<td class="name"><div>
		<a class="anchor" href="#_createWithUrl">#</a>
		<code><a href="source-class-LeanCloud.File.html#70-83" title="Go to source code">createWithUrl</a>( <span>string <var>$name</var></span>, <span>string <var>$url</var></span>, <span>string <var>$mimeType</var> = <span class="php-keyword1">null</span></span> )</code>

		<div class="description short">
			<p>Create file with public external URL</p>
		</div>

		<div class="description detailed hidden">
			<p>Create file with public external URL</p>


				<h4>Parameters</h4>
				<div class="list"><dl>
					<dt><var>$name</var></dt>
					<dd>File base name</dd>
					<dt><var>$url</var></dt>
					<dd>Public URL</dd>
					<dt><var>$mimeType</var></dt>
					<dd>(optional)</dd>
				</dl></div>

				<h4>Returns</h4>
				<div class="list">
					<code><a href="class-LeanCloud.File.html">LeanCloud\File</a></code>
				</div>




		</div>
		</div></td>
	</tr>
	<tr data-order="createWithData" id="_createWithData">

		<td class="attributes"><code>
			 public static

			<code><a href="class-LeanCloud.File.html">LeanCloud\File</a></code>
			
			</code>
		</td>

		<td class="name"><div>
		<a class="anchor" href="#_createWithData">#</a>
		<code><a href="source-class-LeanCloud.File.html#85-96" title="Go to source code">createWithData</a>( <span>string <var>$name</var></span>, <span>string <var>$data</var></span>, <span>string <var>$mimeType</var> = <span class="php-keyword1">null</span></span> )</code>

		<div class="description short">
			<p>Create file with raw data</p>
		</div>

		<div class="description detailed hidden">
			<p>Create file with raw data</p>


				<h4>Parameters</h4>
				<div class="list"><dl>
					<dt><var>$name</var></dt>
					<dd>File name</dd>
					<dt><var>$data</var></dt>
					<dd>File content</dd>
					<dt><var>$mimeType</var></dt>
					<dd></dd>
				</dl></div>

				<h4>Returns</h4>
				<div class="list">
					<code><a href="class-LeanCloud.File.html">LeanCloud\File</a></code>
				</div>




		</div>
		</div></td>
	</tr>
	<tr data-order="createWithLocalFile" id="_createWithLocalFile">

		<td class="attributes"><code>
			 public static

			<code><a href="class-LeanCloud.File.html">LeanCloud\File</a></code>
			
			</code>
		</td>

		<td class="name"><div>
		<a class="anchor" href="#_createWithLocalFile">#</a>
		<code><a href="source-class-LeanCloud.File.html#98-116" title="Go to source code">createWithLocalFile</a>( <span>string <var>$filepath</var></span>, <span>string <var>$mimeType</var> = <span class="php-keyword1">null</span></span>, <span>string <var>$name</var> = <span class="php-keyword1">null</span></span> )</code>

		<div class="description short">
			<p>Create file from disk</p>
		</div>

		<div class="description detailed hidden">
			<p>Create file from disk</p>


				<h4>Parameters</h4>
				<div class="list"><dl>
					<dt><var>$filepath</var></dt>
					<dd>Absolute file path</dd>
					<dt><var>$mimeType</var></dt>
					<dd>E.g. "image/png"</dd>
					<dt><var>$name</var></dt>
					<dd>Name of file</dd>
				</dl></div>

				<h4>Returns</h4>
				<div class="list">
					<code><a href="class-LeanCloud.File.html">LeanCloud\File</a></code>
				</div>

				<h4>Throws</h4>
				<div class="list">
					RuntimeException
				</div>



		</div>
		</div></td>
	</tr>
	<tr data-order="get" id="_get">

		<td class="attributes"><code>
			 public 

			mixed
			
			</code>
		</td>

		<td class="name"><div>
		<a class="anchor" href="#_get">#</a>
		<code><a href="source-class-LeanCloud.File.html#118-129" title="Go to source code">get</a>( <span>string <var>$key</var></span> )</code>

		<div class="description short">
			<p>Get file attribute</p>
		</div>

		<div class="description detailed hidden">
			<p>Get file attribute</p>


				<h4>Parameters</h4>
				<div class="list"><dl>
					<dt><var>$key</var></dt>
					<dd></dd>
				</dl></div>

				<h4>Returns</h4>
				<div class="list">
					mixed
				</div>




		</div>
		</div></td>
	</tr>
	<tr data-order="getName" id="_getName">

		<td class="attributes"><code>
			 public 

			string
			
			</code>
		</td>

		<td class="name"><div>
		<a class="anchor" href="#_getName">#</a>
		<code><a href="source-class-LeanCloud.File.html#131-138" title="Go to source code">getName</a>( )</code>

		<div class="description short">
			<p>Get name of file</p>
		</div>

		<div class="description detailed hidden">
			<p>Get name of file</p>



				<h4>Returns</h4>
				<div class="list">
					string
				</div>




		</div>
		</div></td>
	</tr>
	<tr data-order="getObjectId" id="_getObjectId">

		<td class="attributes"><code>
			 public 

			string
			
			</code>
		</td>

		<td class="name"><div>
		<a class="anchor" href="#_getObjectId">#</a>
		<code><a href="source-class-LeanCloud.File.html#140-147" title="Go to source code">getObjectId</a>( )</code>

		<div class="description short">
			<p>Get objectId of file</p>
		</div>

		<div class="description detailed hidden">
			<p>Get objectId of file</p>



				<h4>Returns</h4>
				<div class="list">
					string
				</div>




		</div>
		</div></td>
	</tr>
	<tr data-order="getCreatedAt" id="_getCreatedAt">

		<td class="attributes"><code>
			 public 

			DateTime
			
			</code>
		</td>

		<td class="name"><div>
		<a class="anchor" href="#_getCreatedAt">#</a>
		<code><a href="source-class-LeanCloud.File.html#149-154" title="Go to source code">getCreatedAt</a>( )</code>

		<div class="description short">
			
		</div>

		<div class="description detailed hidden">
			



				<h4>Returns</h4>
				<div class="list">
					DateTime
				</div>




		</div>
		</div></td>
	</tr>
	<tr data-order="getUpdatedAt" id="_getUpdatedAt">

		<td class="attributes"><code>
			 public 

			DateTime
			
			</code>
		</td>

		<td class="name"><div>
		<a class="anchor" href="#_getUpdatedAt">#</a>
		<code><a href="source-class-LeanCloud.File.html#156-161" title="Go to source code">getUpdatedAt</a>( )</code>

		<div class="description short">
			
		</div>

		<div class="description detailed hidden">
			



				<h4>Returns</h4>
				<div class="list">
					DateTime
				</div>




		</div>
		</div></td>
	</tr>
	<tr data-order="getMimeType" id="_getMimeType">

		<td class="attributes"><code>
			 public 

			string
			
			</code>
		</td>

		<td class="name"><div>
		<a class="anchor" href="#_getMimeType">#</a>
		<code><a href="source-class-LeanCloud.File.html#163-170" title="Go to source code">getMimeType</a>( )</code>

		<div class="description short">
			<p>Get file MIME type</p>
		</div>

		<div class="description detailed hidden">
			<p>Get file MIME type</p>



				<h4>Returns</h4>
				<div class="list">
					string
				</div>




		</div>
		</div></td>
	</tr>
	<tr data-order="getUrl" id="_getUrl">

		<td class="attributes"><code>
			 public 

			string
			
			</code>
		</td>

		<td class="name"><div>
		<a class="anchor" href="#_getUrl">#</a>
		<code><a href="source-class-LeanCloud.File.html#172-179" title="Go to source code">getUrl</a>( )</code>

		<div class="description short">
			<p>Get file url</p>
		</div>

		<div class="description detailed hidden">
			<p>Get file url</p>



				<h4>Returns</h4>
				<div class="list">
					string
				</div>




		</div>
		</div></td>
	</tr>
	<tr data-order="getThumbUrl" id="_getThumbUrl">

		<td class="attributes"><code>
			 public 

			string
			
			</code>
		</td>

		<td class="name"><div>
		<a class="anchor" href="#_getThumbUrl">#</a>
		<code><a href="source-class-LeanCloud.File.html#181-211" title="Go to source code">getThumbUrl</a>( <span>float|integer <var>$width</var></span>, <span>float|integer <var>$height</var></span>, <span>float|integer <var>$quality</var> = <span class="php-num">100</span></span>, <span>boolean <var>$scaleToFit</var> = <span class="php-keyword1">true</span></span>, <span>string <var>$format</var> = <span class="php-quote">&quot;png&quot;</span></span> )</code>

		<div class="description short">
			<p>Get thumbnail URL</p>
		</div>

		<div class="description detailed hidden">
			<p>Get thumbnail URL</p>

<p>It returns a URL that could be used to display file thumbnail on
client. The thumbnail will be generated on-the-fly when request
arrives.</p>


				<h4>Parameters</h4>
				<div class="list"><dl>
					<dt><var>$width</var></dt>
					<dd>Image width</dd>
					<dt><var>$height</var></dt>
					<dd>Image height</dd>
					<dt><var>$quality</var></dt>
					<dd>Image quality factor between 0 ~ 100</dd>
					<dt><var>$scaleToFit</var></dt>
					<dd>Scale to fit, or cut to fit</dd>
					<dt><var>$format</var></dt>
					<dd>Image format: gif, png, webp etc.</dd>
				</dl></div>

				<h4>Returns</h4>
				<div class="list">
					string
				</div>




		</div>
		</div></td>
	</tr>
	<tr data-order="getSize" id="_getSize">

		<td class="attributes"><code>
			 public 

			integer
			
			</code>
		</td>

		<td class="name"><div>
		<a class="anchor" href="#_getSize">#</a>
		<code><a href="source-class-LeanCloud.File.html#213-220" title="Go to source code">getSize</a>( )</code>

		<div class="description short">
			<p>Get file size</p>
		</div>

		<div class="description detailed hidden">
			<p>Get file size</p>



				<h4>Returns</h4>
				<div class="list">
					integer
				</div>




		</div>
		</div></td>
	</tr>
	<tr data-order="getOwnerId" id="_getOwnerId">

		<td class="attributes"><code>
			 public 

			string|null
			
			</code>
		</td>

		<td class="name"><div>
		<a class="anchor" href="#_getOwnerId">#</a>
		<code><a href="source-class-LeanCloud.File.html#222-229" title="Go to source code">getOwnerId</a>( )</code>

		<div class="description short">
			<p>Get id of uploaded user</p>
		</div>

		<div class="description detailed hidden">
			<p>Get id of uploaded user</p>



				<h4>Returns</h4>
				<div class="list">
					string|null
				</div>




		</div>
		</div></td>
	</tr>
	<tr data-order="setMeta" id="_setMeta">

		<td class="attributes"><code>
			 public 

			<code><a href="class-LeanCloud.File.html">LeanCloud\File</a></code>
			
			</code>
		</td>

		<td class="name"><div>
		<a class="anchor" href="#_setMeta">#</a>
		<code><a href="source-class-LeanCloud.File.html#231-241" title="Go to source code">setMeta</a>( <span>string <var>$key</var></span>, <span>miexed <var>$val</var></span> )</code>

		<div class="description short">
			<p>Set meta data</p>
		</div>

		<div class="description detailed hidden">
			<p>Set meta data</p>


				<h4>Parameters</h4>
				<div class="list"><dl>
					<dt><var>$key</var></dt>
					<dd></dd>
					<dt><var>$val</var></dt>
					<dd></dd>
				</dl></div>

				<h4>Returns</h4>
				<div class="list">
					<code><a href="class-LeanCloud.File.html">LeanCloud\File</a></code>
				</div>




		</div>
		</div></td>
	</tr>
	<tr data-order="getMeta" id="_getMeta">

		<td class="attributes"><code>
			 public 

			mixed
			
			</code>
		</td>

		<td class="name"><div>
		<a class="anchor" href="#_getMeta">#</a>
		<code><a href="source-class-LeanCloud.File.html#243-260" title="Go to source code">getMeta</a>( <span>string <var>$key</var> = <span class="php-keyword1">null</span></span> )</code>

		<div class="description short">
			<p>Get meta data</p>
		</div>

		<div class="description detailed hidden">
			<p>Get meta data</p>

<p>It returns all metaData if key is null</p>


				<h4>Parameters</h4>
				<div class="list"><dl>
					<dt><var>$key</var></dt>
					<dd></dd>
				</dl></div>

				<h4>Returns</h4>
				<div class="list">
					mixed
				</div>




		</div>
		</div></td>
	</tr>
	<tr data-order="mergeAfterSave" id="_mergeAfterSave">

		<td class="attributes"><code>
			 public 

			
			
			</code>
		</td>

		<td class="name"><div>
		<a class="anchor" href="#_mergeAfterSave">#</a>
		<code><a href="source-class-LeanCloud.File.html#309-325" title="Go to source code">mergeAfterSave</a>( <span>array <var>$data</var></span> )</code>

		<div class="description short">
			<p>Merge server response after save</p>
		</div>

		<div class="description detailed hidden">
			<p>Merge server response after save</p>


				<h4>Parameters</h4>
				<div class="list"><dl>
					<dt><var>$data</var></dt>
					<dd>JSON decoded response</dd>
				</dl></div>





		</div>
		</div></td>
	</tr>
	<tr data-order="mergeAfterFetch" id="_mergeAfterFetch">

		<td class="attributes"><code>
			 public 

			
			
			</code>
		</td>

		<td class="name"><div>
		<a class="anchor" href="#_mergeAfterFetch">#</a>
		<code><a href="source-class-LeanCloud.File.html#327-339" title="Go to source code">mergeAfterFetch</a>( <span>array <var>$data</var></span> )</code>

		<div class="description short">
			<p>Merge server response after fetch</p>
		</div>

		<div class="description detailed hidden">
			<p>Merge server response after fetch</p>


				<h4>Parameters</h4>
				<div class="list"><dl>
					<dt><var>$data</var></dt>
					<dd>JSON decoded response</dd>
				</dl></div>





		</div>
		</div></td>
	</tr>
	<tr data-order="isDirty" id="_isDirty">

		<td class="attributes"><code>
			 public 

			boolean
			
			</code>
		</td>

		<td class="name"><div>
		<a class="anchor" href="#_isDirty">#</a>
		<code><a href="source-class-LeanCloud.File.html#341-349" title="Go to source code">isDirty</a>( )</code>

		<div class="description short">
			<p>If there are unsaved changes.</p>
		</div>

		<div class="description detailed hidden">
			<p>If there are unsaved changes.</p>



				<h4>Returns</h4>
				<div class="list">
					boolean
				</div>




		</div>
		</div></td>
	</tr>
	<tr data-order="save" id="_save">

		<td class="attributes"><code>
			 public 

			
			
			</code>
		</td>

		<td class="name"><div>
		<a class="anchor" href="#_save">#</a>
		<code><a href="source-class-LeanCloud.File.html#351-398" title="Go to source code">save</a>( )</code>

		<div class="description short">
			<p>Save file on the cloud</p>
		</div>

		<div class="description detailed hidden">
			<p>Save file on the cloud</p>




				<h4>Throws</h4>
				<div class="list">
					<code><a href="class-LeanCloud.CloudException.html">LeanCloud\CloudException</a></code>
				</div>



		</div>
		</div></td>
	</tr>
	<tr data-order="fetch" id="_fetch">

		<td class="attributes"><code>
			 public static

			<code><a href="class-LeanCloud.File.html">LeanCloud\File</a></code>
			
			</code>
		</td>

		<td class="name"><div>
		<a class="anchor" href="#_fetch">#</a>
		<code><a href="source-class-LeanCloud.File.html#400-413" title="Go to source code">fetch</a>( <span> <var>$objectId</var></span> )</code>

		<div class="description short">
			<p>Fetch file object by id</p>
		</div>

		<div class="description detailed hidden">
			<p>Fetch file object by id</p>

<p>Note it fetches descriptive data from LeanCloud, but not file content.
The content should be fetched from file URL.</p>



				<h4>Returns</h4>
				<div class="list">
					<code><a href="class-LeanCloud.File.html">LeanCloud\File</a></code>
				</div>




		</div>
		</div></td>
	</tr>
	<tr data-order="destroy" id="_destroy">

		<td class="attributes"><code>
			 public 

			
			
			</code>
		</td>

		<td class="name"><div>
		<a class="anchor" href="#_destroy">#</a>
		<code><a href="source-class-LeanCloud.File.html#415-425" title="Go to source code">destroy</a>( )</code>

		<div class="description short">
			<p>Delete file on cloud</p>
		</div>

		<div class="description detailed hidden">
			<p>Delete file on cloud</p>




				<h4>Throws</h4>
				<div class="list">
					<code><a href="class-LeanCloud.CloudException.html">LeanCloud\CloudException</a></code>
				</div>



		</div>
		</div></td>
	</tr>
	<tr data-order="encode" id="_encode">

		<td class="attributes"><code>
			 public 

			array
			
			</code>
		</td>

		<td class="name"><div>
		<a class="anchor" href="#_encode">#</a>
		<code><a href="source-class-LeanCloud.File.html#427-442" title="Go to source code">encode</a>( )</code>

		<div class="description short">
			<p>Encode to JSON representation</p>
		</div>

		<div class="description detailed hidden">
			<p>Encode to JSON representation</p>



				<h4>Returns</h4>
				<div class="list">
					array
				</div>




		</div>
		</div></td>
	</tr>
	</table>


















</div>

	<div id="footer">
		 API documentation generated by <a href="http://apigen.org">ApiGen</a>
	</div>
</div>
</div>
<script src="resources/combined.js"></script>
<script src="elementlist.js"></script>
</body>
</html>
